#!/sbin/openrc-run

: ${GSAD_USER:=gvm}
: ${GSAD_GROUP:=gvm}
: ${GSAD_TIMEOUT:=30}
: ${GSAD_OPTIONS:=--no-redirect --http-only}
: ${GSAD_LISTEN_ADDRESS:=127.0.0.1}
: ${GSAD_LISTEN_PORT:=9392}
: ${GVMD_LISTEN_ADDRESS:=127.0.0.1}
: ${GVMD_LISTEN_PORT:=9390}
: ${GVMD_GNUTLS_PRIORITIES:=NORMAL}

name="Greenbone Security Assistant (GSA)"
command="/usr/bin/gsad"
command_args="${GSAD_OPTIONS} --listen=${GSAD_LISTEN_ADDRESS} --port=${GSAD_LISTEN_PORT} --mlisten=${GVMD_LISTEN_ADDRESS} --mport=${GVMD_LISTEN_PORT} --gnutls-priorities=${GSAD_GNUTLS_PRIORITIES}"
command_user="${GSAD_USER}:${GSAD_GROUP}"
retry="${GSAD_TIMEOUT}"

depend() {
	after firewall
	need net gvmd
}

start_pre() {
	checkpath --directory --owner "$command_user" /run/gsad /var/log/gvm
}
